Skip to content

Add an animation to pane entrance/exit - #7364

Merged
23 commits merged into
masterfrom
dev/migrie/f/panes-animations-2020
Oct 9, 2020
Merged

23 commits merged into
masterfrom
dev/migrie/f/panes-animations-2020

Conversation

@zadjii-msft

@zadjii-msft Mike Griese (zadjii-msft) commented Aug 21, 2020 •

Copy link
Copy Markdown
Member

Adds an entrance animation when panes are created. This animation can be
disabled with the disableAnimations global setting.

Although the XAML animation documentation was pretty heavy on the do it
in XAML
route, our panes are created pretty much entirely in code, so
we've got to create the animations in code as well.

200ms as the duration of the animation was picked super arbitrarily.
300ms felt too long, and 166ms felt like it was only visible for a
single frame.

see also:

Validation Steps Performed

Man have I been opening panes

Closes #1001
Closes #7366

@ghost ghost added Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. labels Aug 21, 2020
@zadjii-msft Mike Griese (zadjii-msft) changed the title Add a aniamtion to pane entrance Add a animation to pane entrance Aug 21, 2020
@miniksa

Copy link
Copy Markdown
Contributor

What about the reverse animation on close pane?

@zadjii-msft

Copy link
Copy Markdown
Member Author

Michael Niksa (@miniksa)

What about the reverse animation on close pane?

That's #7366 😉

@miniksa Michael Niksa (miniksa) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine. I just had the one comment I left outside. I feel like the animations should be paired (in and out) before merge.

…animations-2020

# Conflicts:
#	src/cascadia/TerminalApp/GlobalAppSettings.cpp
#	src/cascadia/TerminalApp/GlobalAppSettings.h
@zadjii-msft

Copy link
Copy Markdown
Member Author

Alright so regarding animating the closing of panes.

This will be extra tricky. The simplest way to do it seems like it would be to:

  • In _ChildCloseRoutine, setup and start the animation
  • then on the completion of the animation, call _CloseChild to reparent the remaining panes, their controls, etc.

But that won't actually work for us. If we leave the row/col definitions untouched for the parent when one of their children closes, then even if we make the other child bigger, the child only has half the parent to work with. So the child will get bigger, but still be clipped by the existing rol/col defs

Oh but what if we

  • Remove the closed pane's grid from the parent
  • add a dummy grid in its place
  • set the parent pane's row/col defs to be auto sized, so they're as big as the content
  • animate the remaining pane growing to 100% size
  • animate the dummy grid shrinking in size to 0%
  • pre-resize the remaining pane (& all descendants) to the full size they will have. We'll set their size manually here.
  • start the animation.
  • on completion:
    • remove all the manually set sizes from the remaining pane (& descendants)
    • call _CloseChild to move the content from the remaining pane into the parent (this should be seamless)

Alright so I was about to say "this is too hard for us to do now", but with the auto-sizing of the parent grid this could be possible.

@aharpervc

Copy link
Copy Markdown

Does this feature honor the "Show animations in Windows" setting (which also powers prefers-reduced-motion in browsers)?

@zadjii-msft

Copy link
Copy Markdown
Member Author

Michael Niksa (@miniksa) you wanted closing animations? You get closing animations
pane-closing-animation

@zadjii-msft

Mike Griese (zadjii-msft) commented Aug 27, 2020 •

Copy link
Copy Markdown
Member Author

Does this feature honor the "Show animations in Windows" setting (which also powers prefers-reduced-motion in browsers)?

Weird, this doesn't. But the new tab menu flyout does.

But if you disable animations app-wide with AllowDependentAnimations(false), and enable animations in windows, then the Pane animation doesn't run (expected), but the new tab menu does animate (unexpected). Same behavior with the command palette - it animates even with AllowDependentAnimations(false)

I wonder why that is. I'm gonna ping some XAML folks internally for some answers on this.

@ghost ghost added the Issue-Task It's a feature request, but it doesn't really need a major design. label Aug 27, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd definitely like for us to follow the system API -- there was an e-mail about how we can do it, so I'm gonna block for that and my couple comments.

I won't be around on Friday or Monday. I give permission to clear my review if they are fixed. I sign off apart from that.

I understand why we want a separate setting. It does feel weird though.


// Create the dummy grid. This grid will be the one we actually animate,
// in the place of the closed pane.
Controls::Grid dummyGrid;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be a border? we'll never use its containment properties..

idk, nit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Still curious tho)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just went with a Grid because that's my mental go-to "I need a 2d space" control. Is there a real difference the way I'm using this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naw

Comment thread src/cascadia/TerminalApp/Pane.cpp Resolved
Comment thread src/cascadia/TerminalApp/Pane.cpp Resolved
Comment thread src/cascadia/TerminalApp/Pane.cpp Resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 28, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 28, 2020
@zadjii-msft

Copy link
Copy Markdown
Member Author

Dustin L. Howett (@DHowett) Hey turns out I did the OS setting thing right before I went on leave, wanna take another look?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Augh! Sorry Mike. I wrote up comments and NEVER HIT SUBMIT

// 200ms was chosen because it's quick enough that it doesn't break your
// flow, but not too quick to see
static const int AnimationDurationInMilliseconds = 200;
static const Duration AnimationDuration = DurationHelper::FromTimeSpan(winrt::Windows::Foundation::TimeSpan(std::chrono::milliseconds(AnimationDurationInMilliseconds)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the annoying bit here is that this has to be constructed during llibrary initialization :(


// Create the dummy grid. This grid will be the one we actually animate,
// in the place of the closed pane.
Controls::Grid dummyGrid;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Still curious tho)

@DHowett

Copy link
Copy Markdown
Member

/azp run


// Create the dummy grid. This grid will be the one we actually animate,
// in the place of the closed pane.
Controls::Grid dummyGrid;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naw

@DHowett Dustin L. Howett (DHowett) changed the title Add a animation to pane entrance Add an animation to pane entrance/exit Oct 9, 2020
@DHowett Dustin L. Howett (DHowett) added the AutoMerge Marked for automatic merge by the bot when requirements are met label Oct 9, 2020
@DHowett Dustin L. Howett (DHowett) removed their assignment Oct 9, 2020
@DHowett

Copy link
Copy Markdown
Member

COPIED FROM BODY


Yesterday, I day-of-learned about animation in XAML. The result?

Summary of the Pull Request

Adds an entrance animation when panes are created. This animation can be disabled with the disableAnimations global setting.

pane-animation-pr

and in 60FPS:
pane-animation-60fps
(though, playing that back, I might have the gif sped up a tad bit...)

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

Although the XAML animation documentation was pretty heavy on the do it in XAML route, our panes are created pretty much entirely in code, so we've got to create the animations in code as well.

200ms as the duration of the animation was picked super arbitrarily. 300ms felt too long, and 166ms felt like it was only visible for a single frame.

see also:

Validation Steps Performed

Man have I been opening panes

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@ghost

Copy link
Copy Markdown

Hello Dustin L. Howett (@DHowett)!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost
ghost merged commit 9dc38ad into master Oct 9, 2020
@ghost
ghost deleted the dev/migrie/f/panes-animations-2020 branch October 9, 2020 23:06
Chester Liu (skyline75489) pushed a commit to skyline75489/terminal that referenced this pull request Oct 10, 2020
Adds an entrance animation when panes are created. This animation can be
disabled with the `disableAnimations` global setting. 

Although the XAML animation documentation was pretty heavy on the _do it
in XAML_ route, our panes are created pretty much entirely in code, so
we've got to create the animations in code as well. 

200ms as the duration of the animation was picked _super_ arbitrarily.
300ms felt too long, and 166ms felt like it was only visible for a
single frame. 

see also:
* [Motion in practice](https://docs.microsoft.com/en-us/windows/uwp/design/motion/motion-in-practice)
* [This example](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Media.Animation.Storyboard?view=winrt-19041#examples) what what I ended up using, albeit ported to cppwinrt.
* [`Timeline.AllowDependentAnimations`](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.animation.timeline.allowdependentanimations?view=winrt-19041#Windows_UI_Xaml_Media_Animation_Timeline_AllowDependentAnimations)
* [easing functions](https://docs.microsoft.com/en-us/windows/uwp/design/motion/key-frame-and-easing-function-animations#easing-functions)

## Validation Steps Performed
Man have I been opening panes

Closes microsoft#1001
Closes microsoft#7366
Carlos Zamora (carlos-zamora) pushed a commit that referenced this pull request Oct 30, 2020
## Summary of the Pull Request
Since we've started working on the Settings UI, a few settings have been added on `main`. This adds those missing settings over. 

## References
Missing settings include...
- #7364: `disableAnimations`
- #7873: `launchMode` `focus` and `maximizedFocus`
- #7793: `bellStyle`

## Validation Steps Performed
Verified that those settings appear properly in the Settings UI.
@ghost

Copy link
Copy Markdown

🎉Windows Terminal Preview v1.5.3142.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-UserInterface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Second It's a PR that needs another sign-off Priority-3 A description (P3) Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panes should have an animation when they're closed, too Panes should have an optional motion effect on entrance

6 participants